package com.tbit.uqbike.object.pojo.vo;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.tbit.uqbike.annos.Excel;
import com.tbit.uqbike.constant.BmsConfigConstant;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.Date;

/**
 * 云bms电池返回值实体类
 *
 * @Author:BUGTian
 * @DATE: 2022/7/19
 */
@Data
@Accessors(chain = true)
public class BatteryVO {

    /**
     * 区域名称
     */
    @Excel(name = "运营区域", sort = 1)
    private String accountName;
    /**
     * 电池编号
     */
    @Excel(name = "电池编号", sort = 2)
    private String batteryNo;
    /**
     * 电池型号id
     */
    private Integer batteryModelId;
    /**
     * 电池型号
     */
    @Excel(name = "电池型号", sort = 3)
    private String batteryModel;
    /**
     * 电池容量
     */
    @Excel(name = "电池容量", sort = 4)
    private String batteryCapacity;
    /**
     * 电池电压
     */
    @Excel(name = "电池电压", sort = 5)
    private String batteryU;
    /**
     * 区域id
     */
    private Integer accountId;

    /**
     * 添加用户id
     */
    private Integer accountUserId;

    /**
     * 状态
     */
    private Integer state;

    /**
     * 备注
     */
    private String remark;

    /**
     * 修改时间
     */
    private Date updateTime;
    /**
     * 添加时间
     */
    @Excel(name = "入库时间", sort = 6, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date addTime;
    /**
     * 初次使用时间
     */
//    @Excel(name = "初次使用时间", sort = 6, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date firstTime;
    /**
     * 总骑行里程，单位米
     */
    private Double sumMileage;
    /**
     * 电池当前所在车辆
     */
    @Excel(name = "电池当前所在车辆", sort = 16)
    private String userCode;


    //本次换电时间
    @Excel(name = "本次换电时间", sort = 13)
    private String currentChangeTime;
    //当前旧电量
//    @Excel(name = "当前旧电量", sort = 14)
    private int currentOldSoc;
    //当前新电量
//    @Excel(name = "当前新电量", sort = 14)
    private int currentNewSoc;
    //当前消耗电量
    @Excel(name = "本次换电消耗净电量", sort = 15)
    private int consumptionSoc;
    //当前骑行里程
    @Excel(name = "本次换电骑行里程", sort = 14)
    private double currentMileage;
    //上一次换点时间
    private String previousChangeTime;
    //上一次旧电量
//    @Excel(name = "上一次旧电量", sort = 14)
    private int previousOldSoc;
    //上一次新电量
//    @Excel(name = "上一次新电量", sort = 14)
    private int previousNewSoc;
    //上一次骑行里程
//    @Excel(name = "上一次骑行里程", sort = 14)
    private double previousMileage;



    public  void setConsumptionSoc(){
        this.consumptionSoc = previousNewSoc - currentOldSoc;
        if (consumptionSoc < 0){
            consumptionSoc = -1;
        }
    }


}
